/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PreguntaFrame.java
 *
 * Created on 09-ene-2012, 19:32:05
 */
package occho.view;

import java.sql.SQLException;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
import javax.swing.GroupLayout;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
import javax.swing.event.ListSelectionEvent;
import occho.model.*;
import occho.view.resources.Messages;

/**
 *
 * @author Juan Antonio
 */
public class PreguntaFrame extends javax.swing.JInternalFrame implements Internacionalizable {

    /** Creates new form PreguntaFrame */
    Test test;
    Usuario usuario;
    ArrayList<ImageIcon> liconos;
    ArrayList<PreguntaAlumno> lpreguntasalumnos;
    ArrayList<JRadioButton> lbotones;
    ArrayList<JTextArea> ltextos;
    Pregunta preguntaActual;
    PreguntaAlumno pAlumnActual;
    Icon icono;
    int numPregContestadas;
    FachadaRealizarTest fachada;
    
    /**
     * Constructor de la clase
     * @param test
     * @param user
     */
    public PreguntaFrame(Test test, Usuario user) {
        initComponents();
        this.test=test;
        this.usuario=user;
        this.numPregContestadas=0;
        this.fachada=new FachadaRealizarTest();
        
        this.tituloLabel.setText(this.test.getNombre());
        this.descripcionLabel.setText(this.test.getDescripcion());
        
        DefaultListModel model=new DefaultListModel();
        this.lpreguntasalumnos= new ArrayList<PreguntaAlumno>();
        Iterator it=this.test.getPreguntas().iterator();
        while(it.hasNext()){
            Pregunta p=(Pregunta) it.next();
            PreguntaAlumno pa = new PreguntaAlumno(p.getIdPregunta(), this.usuario.getIdUsuario(), false, this.test.getIdTest(), false);
            lpreguntasalumnos.add(pa);
            model.addElement(pa);
        }
        
        try {
            this.fachada.realizarTest(lpreguntasalumnos);
        } catch (SQLException ex) {
            Logger.getLogger(PreguntaFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        this.preguntasList.setModel(model);
        liconos=new ArrayList<ImageIcon>();
        liconos.add(new ImageIcon(getClass().getResource("/occho/view/resources/bullet_tick.png")));
        liconos.add(new ImageIcon(getClass().getResource("/occho/view/resources/bullet_cross.png")));
        liconos.add(new ImageIcon(getClass().getResource("/occho/view/resources/play_blue.png")));
        this.preguntasList.setCellRenderer(new MyCellRenderer(liconos));
     
        this.lbotones=new ArrayList<JRadioButton>();
        this.lbotones.add(0,resp1RadioButton);
        this.lbotones.add(1,resp2RadioButton);
        this.lbotones.add(2,resp3RadioButton);
        this.lbotones.add(3,resp4RadioButton);
        
        this.ltextos= new ArrayList<JTextArea>();
        this.ltextos.add(0,resp1TextArea);
        this.ltextos.add(1,resp2TextArea);
        this.ltextos.add(2,resp3TextArea);
        this.ltextos.add(3,resp4TextArea);
        
        for(JTextArea ta: this.ltextos){
            ta.setLineWrap(true);
            ta.setWrapStyleWord(true);
        }
        
        deshabilitarComponentes();
        this.icono=this.resp1RadioButton.getIcon();
        
        setLenguaje();
    }
    
    private void mostrarPregunta(){
        deshabilitarComponentes();
        //this.pAlumnActual=(PreguntaAlumno) this.preguntasList.getSelectedValue();
        //this.preguntaActual=this.test.getPregunta(this.pAlumnActual.getIdPregunta());
        this.enunciadoTextArea.setText(this.preguntaActual.getEnunciado());
        int numResp=this.preguntaActual.getNumRespuestas();
        for(int i=0; i<numResp; i++){
            //this.lbotones.get(i).setEnabled(true);
            this.ltextos.get(i).setEnabled(true);
            this.ltextos.get(i).setText(this.preguntaActual.getRespuestas().get(i).getTexto());
        } 
        if(!this.pAlumnActual.isContestada()){
            for(int i=0; i<numResp; i++){
                this.lbotones.get(i).setEnabled(true);
                this.lbotones.get(i).setIcon(this.icono);
            } 
            this.confirmarRespButton.setEnabled(false);
        }
        else{
            cambiarRadioButtons(false);
            int correcta=this.preguntaActual.getRespuestaCorrecta();
            this.lbotones.get(correcta).setIcon(new ImageIcon(getClass().getResource("/occho/view/resources/bullet_tick.png")));
            this.lbotones.get(correcta).setEnabled(true);
            if(!this.pAlumnActual.isAcertada()){
                int contestada=this.pAlumnActual.getNumContestada();
                this.lbotones.get(contestada).setIcon(new ImageIcon(getClass().getResource("/occho/view/resources/bullet_cross.png")));
                this.lbotones.get(contestada).setEnabled(true);
            }
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        tituloLabel = new javax.swing.JLabel();
        listaPanel = new javax.swing.JScrollPane();
        preguntasList = new javax.swing.JList();
        descripcionLabel = new javax.swing.JLabel();
        enunciadoPanel = new javax.swing.JScrollPane();
        enunciadoTextArea = new javax.swing.JTextArea();
        respuestasPanel = new javax.swing.JPanel();
        resp1RadioButton = new javax.swing.JRadioButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        resp1TextArea = new javax.swing.JTextArea();
        resp3RadioButton = new javax.swing.JRadioButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        resp3TextArea = new javax.swing.JTextArea();
        resp2RadioButton = new javax.swing.JRadioButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        resp2TextArea = new javax.swing.JTextArea();
        jScrollPane4 = new javax.swing.JScrollPane();
        resp4TextArea = new javax.swing.JTextArea();
        resp4RadioButton = new javax.swing.JRadioButton();
        confirmarRespButton = new javax.swing.JButton();
        terminarTestButton = new javax.swing.JButton();

        buttonGroup1.add(this.resp1RadioButton);
        buttonGroup1.add(this.resp2RadioButton);
        buttonGroup1.add(this.resp3RadioButton);
        buttonGroup1.add(this.resp4RadioButton);

        setName("Form"); // NOI18N
        setOpaque(true);

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(occho.OcchoApp.class).getContext().getResourceMap(PreguntaFrame.class);
        tituloLabel.setFont(resourceMap.getFont("tituloLabel.font")); // NOI18N
        tituloLabel.setText(resourceMap.getString("tituloLabel.text")); // NOI18N
        tituloLabel.setName("tituloLabel"); // NOI18N

        listaPanel.setName("listaPanel"); // NOI18N

        preguntasList.setName("preguntasList"); // NOI18N
        preguntasList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                preguntasListValueChanged(evt);
            }
        });
        listaPanel.setViewportView(preguntasList);

        descripcionLabel.setFont(resourceMap.getFont("descripcionLabel.font")); // NOI18N
        descripcionLabel.setText(resourceMap.getString("descripcionLabel.text")); // NOI18N
        descripcionLabel.setName("descripcionLabel"); // NOI18N

        enunciadoPanel.setName("enunciadoPanel"); // NOI18N

        enunciadoTextArea.setColumns(20);
        enunciadoTextArea.setLineWrap(true);
        enunciadoTextArea.setRows(5);
        enunciadoTextArea.setWrapStyleWord(true);
        enunciadoTextArea.setName("enunciadoTextArea"); // NOI18N
        enunciadoPanel.setViewportView(enunciadoTextArea);

        respuestasPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        respuestasPanel.setName("respuestasPanel"); // NOI18N

        buttonGroup1.add(resp1RadioButton);
        resp1RadioButton.setText(resourceMap.getString("resp1RadioButton.text")); // NOI18N
        resp1RadioButton.setEnabled(false);
        resp1RadioButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        resp1RadioButton.setName("resp1RadioButton"); // NOI18N
        resp1RadioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioButtonActionPerformed(evt);
            }
        });

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        resp1TextArea.setColumns(20);
        resp1TextArea.setLineWrap(true);
        resp1TextArea.setRows(5);
        resp1TextArea.setWrapStyleWord(true);
        resp1TextArea.setName("resp1TextArea"); // NOI18N
        jScrollPane1.setViewportView(resp1TextArea);

        buttonGroup1.add(resp3RadioButton);
        resp3RadioButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        resp3RadioButton.setName("resp3RadioButton"); // NOI18N
        resp3RadioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioButtonActionPerformed(evt);
            }
        });

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        resp3TextArea.setColumns(20);
        resp3TextArea.setLineWrap(true);
        resp3TextArea.setRows(5);
        resp3TextArea.setWrapStyleWord(true);
        resp3TextArea.setName("resp3TextArea"); // NOI18N
        jScrollPane2.setViewportView(resp3TextArea);

        buttonGroup1.add(resp2RadioButton);
        resp2RadioButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        resp2RadioButton.setName("resp2RadioButton"); // NOI18N
        resp2RadioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioButtonActionPerformed(evt);
            }
        });

        jScrollPane3.setName("jScrollPane3"); // NOI18N

        resp2TextArea.setColumns(20);
        resp2TextArea.setLineWrap(true);
        resp2TextArea.setRows(5);
        resp2TextArea.setWrapStyleWord(true);
        resp2TextArea.setName("resp2TextArea"); // NOI18N
        jScrollPane3.setViewportView(resp2TextArea);

        jScrollPane4.setName("jScrollPane4"); // NOI18N

        resp4TextArea.setColumns(20);
        resp4TextArea.setLineWrap(true);
        resp4TextArea.setRows(5);
        resp4TextArea.setWrapStyleWord(true);
        resp4TextArea.setName("resp4TextArea"); // NOI18N
        jScrollPane4.setViewportView(resp4TextArea);

        buttonGroup1.add(resp4RadioButton);
        resp4RadioButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        resp4RadioButton.setName("resp4RadioButton"); // NOI18N
        resp4RadioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout respuestasPanelLayout = new javax.swing.GroupLayout(respuestasPanel);
        respuestasPanel.setLayout(respuestasPanelLayout);
        respuestasPanelLayout.setHorizontalGroup(
            respuestasPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(respuestasPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(respuestasPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(resp1RadioButton, javax.swing.GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE)
                    .addComponent(resp2RadioButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(resp3RadioButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(resp4RadioButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(respuestasPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE))
                .addContainerGap())
        );
        respuestasPanelLayout.setVerticalGroup(
            respuestasPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(respuestasPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(respuestasPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(resp1RadioButton, javax.swing.GroupLayout.DEFAULT_SIZE, 65, Short.MAX_VALUE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 65, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(respuestasPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 65, Short.MAX_VALUE)
                    .addComponent(resp2RadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(respuestasPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(resp3RadioButton, javax.swing.GroupLayout.DEFAULT_SIZE, 65, Short.MAX_VALUE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 65, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(respuestasPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(resp4RadioButton, javax.swing.GroupLayout.DEFAULT_SIZE, 63, Short.MAX_VALUE)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 63, Short.MAX_VALUE))
                .addContainerGap())
        );

        confirmarRespButton.setText(resourceMap.getString("confirmarRespButton.text")); // NOI18N
        confirmarRespButton.setName("confirmarRespButton"); // NOI18N
        confirmarRespButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                confirmarRespButtonActionPerformed(evt);
            }
        });

        terminarTestButton.setText(resourceMap.getString("terminarTestButton.text")); // NOI18N
        terminarTestButton.setEnabled(false);
        terminarTestButton.setName("terminarTestButton"); // NOI18N
        terminarTestButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                terminarTestButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(terminarTestButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(listaPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(enunciadoPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE)
                            .addComponent(respuestasPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(confirmarRespButton, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(tituloLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(descripcionLabel)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tituloLabel)
                    .addComponent(descripcionLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(enunciadoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(respuestasPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(listaPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 266, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(terminarTestButton)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
                .addComponent(confirmarRespButton)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void preguntasListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_preguntasListValueChanged
        // TODO add your handling code here:
        //deshabilitarComponentes();
        this.pAlumnActual=(PreguntaAlumno) this.preguntasList.getSelectedValue();
        this.preguntaActual=this.test.getPregunta(this.pAlumnActual.getIdPregunta());
        mostrarPregunta();
        /*this.enunciadoTextArea.setText(this.preguntaActual.getEnunciado());
        int numResp=this.preguntaActual.getRespuestas().size();
        for(int i=0; i<numResp; i++){
            this.lbotones.get(i).setEnabled(true);
            this.ltextos.get(i).setEnabled(true);
            this.ltextos.get(i).setText(this.preguntaActual.getRespuestas().get(i).getTexto());
        }*/   
    }//GEN-LAST:event_preguntasListValueChanged

private void radioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioButtonActionPerformed
// TODO add your handling code here:
    if(!this.pAlumnActual.isContestada())
        this.confirmarRespButton.setEnabled(true);
}//GEN-LAST:event_radioButtonActionPerformed

private void confirmarRespButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_confirmarRespButtonActionPerformed
// TODO add your handling code here:
    this.numPregContestadas++;
    this.confirmarRespButton.setEnabled(false);
    int correcta=this.preguntaActual.getRespuestaCorrecta();
    int contestada=0;
    for(int i=0; i<this.lbotones.size(); i++){
        if(this.lbotones.get(i).isSelected()) 
            contestada=i;
    }
    this.pAlumnActual.setContestada(true);
    this.pAlumnActual.setNumContestada(contestada);
    if(correcta==pAlumnActual.getNumContestada())
        this.pAlumnActual.setAcertada(true);
    else
        this.pAlumnActual.setAcertada(false);
    
    try {
        this.fachada.actualizarPreguntaAlumno(pAlumnActual);
    } catch (ClassNotFoundException ex) {
        Logger.getLogger(PreguntaFrame.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SQLException ex) {
        Logger.getLogger(PreguntaFrame.class.getName()).log(Level.SEVERE, null, ex);
    }
    
    mostrarPregunta();
    if(this.numPregContestadas==this.lpreguntasalumnos.size())
        this.terminarTestButton.setEnabled(true);
}//GEN-LAST:event_confirmarRespButtonActionPerformed

private void terminarTestButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_terminarTestButtonActionPerformed
// TODO add your handling code here:
    JOptionPane.showMessageDialog(null, "El test se ha realizado correctamente");
    this.setClosable(true);
    this.terminarTestButton.setEnabled(false);
        try {
            usuario.setAsignaturas(fachada.getAsignaturas(usuario));
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(PreguntaFrame.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(PreguntaFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_terminarTestButtonActionPerformed

    private void cambiarRadioButtons(boolean b){
        for(JRadioButton rb: this.lbotones){
            rb.setEnabled(b);
            if(!b)
                rb.setSelectedIcon(null);
        }
    }

    
    private void deshabilitarComponentes(){
        cambiarRadioButtons(false);
        for(JRadioButton ra: this.lbotones){
            ra.setIcon(this.icono);
        }
        
        for(JTextArea ta: this.ltextos){
            ta.setEnabled(false);
            ta.setText("");
        }
        buttonGroup1.clearSelection();
        this.confirmarRespButton.setEnabled(false);
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton confirmarRespButton;
    private javax.swing.JLabel descripcionLabel;
    private javax.swing.JScrollPane enunciadoPanel;
    private javax.swing.JTextArea enunciadoTextArea;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane listaPanel;
    private javax.swing.JList preguntasList;
    private javax.swing.JRadioButton resp1RadioButton;
    private javax.swing.JTextArea resp1TextArea;
    private javax.swing.JRadioButton resp2RadioButton;
    private javax.swing.JTextArea resp2TextArea;
    private javax.swing.JRadioButton resp3RadioButton;
    private javax.swing.JTextArea resp3TextArea;
    private javax.swing.JRadioButton resp4RadioButton;
    private javax.swing.JTextArea resp4TextArea;
    private javax.swing.JPanel respuestasPanel;
    private javax.swing.JButton terminarTestButton;
    private javax.swing.JLabel tituloLabel;
    // End of variables declaration//GEN-END:variables

    /**
     * Establece lenguaje
     */
    public void setLenguaje() {
        setTitle(Messages.getString("Form.title", Messages.BUNDLE_NAME_PREGUNTA));
        confirmarRespButton.setText(Messages.getString("confirmarRespButton.text", Messages.BUNDLE_NAME_PREGUNTA));
        terminarTestButton.setText(Messages.getString("terminarTestButton.text", Messages.BUNDLE_NAME_PREGUNTA));
    }
    
    

}
